#!/bin/bash
THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l)
cd src/
# libiconv install
tar zxvf libiconv-1.15.tar.gz
cd libiconv-1.15/
./configure
make -j ${THREAD} && make install
cd ../
##install curl
#tar xzf curl-7.54.1.tar.gz
#cd  curl-7.54.1
#./configure --prefix=/usr/local
#make -j ${THREAD} && make install
#cd ..
#fix yum
echo "/usr/lib64" > /etc/ld.so.conf.d/local.conf
ldconfig
#libmcrypt install
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make -j ${THREAD} && make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make -j ${THREAD} && make install
cd ../../
#mhash install
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make -j ${THREAD} && make install
cd ../
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf
ldconfig
#mcrypt install
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
./configure
make -j ${THREAD} && make install
cd ../
if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
        ln -s /usr/lib64/libpng.* /usr/lib/
        ln -s /usr/lib64/libjpeg.* /usr/lib/
fi
#if [ -d "/usr/lib64" ] && [ ! `grep -l '/usr/lib64'    '/etc/ld.so.conf'` ]; then
#        sed -i "1i/usr/lib64"  /etc/ld.so.conf.d/local.conf
#	ldconfig
#fi
#cat >>/etc/security/limits.conf<<eof
#* soft nproc 65535
#* hard nproc 65535
#* soft nofile 65535
#* hard nofile 65535
#eof
#cat >>/etc/sysctl.conf<<eof
#fs.file-max=65535
#eof
#
